package com.rjy.util;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Random;
@Component
public class Code {
    char[] codeSequence={'A','B','C','D','E','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','U','V','W','X','Y','Z',
            'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
            '0','1','2','3','4','5','6','7','8','9'};
    public StringBuilder getCode(){
        //定义随机数
        Random r =new Random();
        StringBuilder builderCode =new StringBuilder();
        for (int i=0;i<4;i++){
            char c =codeSequence[r.nextInt(codeSequence.length)];
            builderCode.append(c);

        }
        return builderCode;
    }
}
